Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure touch events are properly handled for pageX and pageY #15587

Merged
merged 4 commits into from May 8, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented May 8, 2019

Whilst working with an iOS device, I noticed that we were incorrectly trying to access the co-ords for pageX and pageY on the nativeEvent object. They don't exist in this place, rather this change makes it so we access them on the changedTouches array (if it exists). We only take them from the first event, we need to add support multiple touches in the future.

Ref #15257

@sizebot
Copy link

sizebot commented May 8, 2019

Details of bundled changes.

Comparing: c7398f3...497e937

react-events

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-events.development.js 0.0% -0.2% 996 B 996 B 556 B 555 B NODE_DEV
react-events-press.development.js +4.0% +4.3% 18.97 KB 19.74 KB 4.32 KB 4.5 KB UMD_DEV
react-events-press.production.min.js 🔺+2.4% 🔺+4.0% 7.21 KB 7.38 KB 2.51 KB 2.61 KB UMD_PROD
react-events-press.development.js +3.7% +3.8% 20.73 KB 21.49 KB 4.98 KB 5.17 KB NODE_DEV
react-events-press.production.min.js 🔺+2.2% 🔺+3.1% 7.85 KB 8.02 KB 2.81 KB 2.89 KB NODE_PROD
ReactEventsPress-dev.js +4.1% +4.6% 19.08 KB 19.86 KB 4.28 KB 4.48 KB FB_WWW_DEV
ReactEventsPress-prod.js 🔺+6.3% 🔺+5.3% 15.89 KB 16.89 KB 3.27 KB 3.44 KB FB_WWW_PROD
react-events-hover.development.js 0.0% -0.0% 9.14 KB 9.14 KB 2.21 KB 2.21 KB UMD_DEV
react-events-focus-scope.development.js 0.0% +0.1% 4.54 KB 4.54 KB 1.35 KB 1.36 KB NODE_DEV
react-events-drag.development.js 0.0% -0.1% 5.66 KB 5.66 KB 1.6 KB 1.6 KB UMD_DEV

Generated by 🚫 dangerJS

packages/react-events/src/Press.js Show resolved Hide resolved
if (touchEvents.length === 0) {
throw new Error('TouchEvent does not have any changed touches');
}
// TODO: we need to support multi-touch in the future, this is a temp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does multi-touch related to Press?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed in our meeting, we need to consider the user pressing multiple Press event responders at the same time. I'll address this TODO tomorrow in a follow up.

});
});

describe('press with movement (touch events fallback)', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little difficult to follow what happened in this part of the diff. Is this duplicating the entire pointer events test block? If so, I don't think we need to do that (and we don't for mouse events)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't duplicate it all, a lot of it, but I changed a few tests too and remove a few there were mouse related.

@trueadm trueadm merged commit 8abf243 into facebook:master May 8, 2019
@trueadm trueadm deleted the handle-touch-event-coords branch May 8, 2019 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants